Permanent TCP connections across system reboots

ABSTRACT

Network or mobile clients are enabled to keep their connections open across shutdowns and reboots of computer systems. Transactions are suspended while the client system is down, and resumed when it comes back up, allowing end-users to perform orderly shutdowns of their systems (especially useful to save battery power on mobile systems) without risk of losing transactions on open TCP connections.

BACKGROUND OF THE INVENTION

[0001] 1. Technical Field

[0002] This invention relates to maintaining connections for both mobile and non-mobile nodes in computer networks.

[0003] 2. Description of the Prior Art

[0004] Most mobile devices, such as laptop computers, are frequently shutdown for a variety of reasons. For instance, most are battery-powered, so they often shutdown to conserve battery power. Airlines require such devices to be turned off when taking off or landing regardless of the power source. However, each shutdown causes termination of all applications and a loss of network connectivity, which results in substantial inconvenience to the user.

[0005] A problem resulting from the shutdown of a mobile device during an application can be illustrated by an example in which a traveler using a laptop computer in an airport connects to a database server and enters a complex query, which would normally take a long time to execute. However, when the traveler boards the plane, the system must be shutdown prior to takeoff. Upon reaching his destination, the traveler restarts the computer, rebooting the system and restarting the application. Yet, without permanent TCP connections across a system boot, a new connection must be established and the query must be reissued before the reply can be received. Accordingly, prior to the present invention there has been a need for a method by which mobile IP can remain connected across reboots.

SUMMARY OF THE INVENTION

[0006] The invention provides a method, system and apparatus that enables clients to keep their connections open during reboots or shutdowns of networked or mobile computer systems. The invention allows an end-user to perform orderly system shutdowns of mobile systems (especially useful to save battery power on mobile systems), without risk of losing transactions on open TCP connections. The invention further suspends each ongoing transaction while the client system is down, and resumes it when the system comes back up without loss of connectivity.

[0007] The mobile device of the present invention relies upon ‘mobile IP’(RFC 2002) for connectivity. Mobile IP provides a static, unchanging IP address to the remote communication endpoint. The constant address allows the higher layer, such as TCP, to work with the remote endpoint as it travels from one location to another without loss of data. The present invention provides the additional advantage of retaining connectivity, even though the device is shutdown.

[0008] Other features and advantages of this invention will become apparent from the following detailed description of the presently preferred embodiment of the invention, taken in conjunction with the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

[0009]FIG. 1 is a flowchart showing the preferred embodiment of the invention.

[0010]FIG. 2 is a flowchart showing placement of a remote endpoint in a persist state, as needed in the preferred embodiment of the present invention.

[0011]FIG. 3 is a flowchart showing an alternative method for putting the remote endpoint in a persist state.

[0012]FIG. 4 is a flowchart showing a method for rebooting the system after normal shutdown.

DESCRIPTION OF THE PREFERRED EMBODIMENT Overview

[0013] In general, FIG. 1 depicts the process for shutting down the system according to the preferred embodiment without loss of connectivity.

Technical Background

[0014] Configuration

[0015] A system utility is used in the invention to mark the TCP endpoints that are maintained across reboots, step 12. The endpoints are described by the local port, local address, foreign port and foreign address. Alternatively, a method is provided by which endpoints that need to survive the shutdown/reboot cycle may be selected at the time of system shutdown.

[0016] Orderly Shutdown of the TCP Endpoint (Deactivation)

[0017] “Orderly” shutdown, is a deliberate action on the part of the user, as opposed to a system crash or failure, or a power cycle. In the invention, when the system shutdown command is given to the operating system, step 13, it alerts the TCP engine. The system waits for the TCP engine to save the TCP state, for the endpoints configured to survive the shutdown and reboot cycle. If the shutdown is a panic shutdown, the shutdown is handled normally. If the shutdown is orderly, the following steps are performed simultaneously.

[0018] The TCP endpoint stops sending or accepting data from the application, step 14. The TCP engine fails or blocks all read/write calls from the application. An implementation might fail the command with a suitable error code to let the application know that the connection is being ‘deactivated.’ Since the device is ‘going down,’ all interfaces are blocked from accepting new data.

[0019] The local endpoint acknowledges all data that is in the ‘receive’ buffer, and advertises a window of 0 (zero) in the acknowledgement. The remote endpoint then enters a TCP persist state.

[0020] In the preferred embodiment, the state of the TCP endpoint is stored on the disk or software agent, step 16. The state includes such information as the source and destination address, the port numbers, the window sizes, maximum size, data including any urgent data, and other information needed to maintain a TCP connection.

[0021] Received data that has been acknowledged, but not passed to the application, is stored with the TCP state. The data that was received from the application, but not sent across, or sent across but not acknowledged by the other end, is also stored with the TCP state.

[0022] A unique ID, along with the application name, is also stored with the TCP state. An implementation may store other information needed to identify the endpoint in accordance with the needs of the operating system and the environment in which the application is running.

[0023] Once the TCP state has been saved, the socket and TCP control block are dissociated from the file descriptor, step 17, to avoid the endpoint from being closed when the application exits and the file descriptor is closed. In the alternative, if the socket and TCP control block are not disassociated, the TCP engine sends a termination indication (FIN) to the other endpoint.

[0024] Orderly Shutdown of the Application

[0025] At the time the TCP state is saved, the application state is also saved, step 18, although the application on a mobile device is typically lightweight, i.e., without much state.

[0026] Alternatively, the application may be allowed to run to some defined ‘sync’ point, and then the state is saved. There is no need to repeatedly check the state.

[0027] System Reboot and Application Restart

[0028]FIG. 4 shows the process for rebooting the system according to the preferred embodiment. At the time the system reboots, a utility, referred to as the “TCP-reacquire daemon,” is started to read in all of the saved TCP endpoint states, step 43. These endpoint states are added to the port/IP address table of the TCP engine using a system call. The endpoints are marked, so that data on the endpoints will not be accepted/sent until an application actually acquires the endpoint. It also sets up the data structures that are required to manage the connection(s) and initializes the structures with the saved data.

[0029] The application is then restarted, step 44. As noted above, the application is expected to either recover from the saved ‘sync’ point, or be stateless. The application asks for all of the endpoints that were previously connected to it, by application name or ID, step 45.

[0030] Alternatively, the application may request a connection to the remote endpoint by specifying the remote address and port. Reactivating the Connection Reactivation of the connection, step 46, is supported by modifications internal to the operating system kernel, as described below. The TCP engine endpoint is accessed by the application using the existing network APIs (Application Program Interface). For example, in the preferred embodiment, the BSD sockets API is used, although other network APIs may be modified in the same manner, as necessary.

[0031] In practice, to reactivate the connection, the application initially creates the communication endpoint, e.g., a socket( ) system call. For example, the socket API bind( ) call would discover if the requested binding already exists. If so, the binding would have been marked to indicate that it is a ‘reacquire endpoint’ by the ‘TCP-reacquire daemon.’ In the case in which connect( ) is called with an implicit bind( ), the lookup table is searched with the foreign address and port to discover any existing bindings that can be reacquired.

[0032] The socket is linked with the TCP binding and the data associated with the binding is linked with the socket when the connect( ) call is made. The TCP control block is then ‘unmarked’ to allow it to send/receive data. The remote endpoint is sent a byte window advertisement that is greater than zero (window is opened). This causes the remote peer to come out of persist state, and the two endpoints can then exchange data normally.

[0033] Causing the Remote Endpoint to Keep the Connection

[0034] In the absence of the solution presented in the invention, the remote endpoint can be in one of the following three states when the mobile node shuts down (“node” is a generic term referring to individual hardware components that make up a network, e.g., general-purpose computers, stand-alone terminals, portable computers, servers, switches, routers and the like).

[0035] i) The endpoint has transmitted all data it had and all data has been acknowledged. The remote endpoint will not transmit any data since it has none to send. It might send KEEPALIVE probes, if it has been so configured. If the remote endpoint receives some data from its application that needs to be sent to the mobile node, the remote endpoint will attempt transmission, which leads to situation (ii) described below.

[0036] ii) The endpoint has sent some data that has not been acknowledged. The remote endpoint will attempt to retransmit if it does not receive acknowledgement for this data. However, after certain number of attempts without acknowledgment, the remote endpoint will terminate the connection.

[0037] iii) The remote endpoint is in persist state, wherein the mobile node has closed the TCP stream window, in which case the remote host will periodically poll the mobile endpoint. If no response is received, the connection will be terminated.

[0038] Accordingly, all three situations cause the connection to terminate if the remote server does not receive a response. The remote endpoint sets an upper limit on the number of tries that will be made, after which, upon not receiving an answer, the connection will be terminated.

[0039] Alternatively, as shown in FIGS. 2 and 3, the remote endpoint is made to keep the connection. In both cases, the alternatives cause the remote endpoint to enter a persist state.

[0040] Enhancement to Mobile IP (RFC 2002)

[0041] A home “agent” is contacted by the mobile node (whether in the home network or in foreign network), and informed of its intention of shutting down. The mobile node requests the home agent to handle this connection. It sends a zero byte window advertisement to the remote endpoint to place it into persist mode, step 23. The node then requests the agent to handle the persist probes from the remote endpoint. Upon receiving the window advertisement, the remote node will enter persist state and send persist probes, periodically and repetitively polling the connection, step 26.

[0042] Whenever the home agent receives a packet from the remote host, as in step 26, it responds with the window advertisement of 0 (zero bytes), step 27. The window advertisement is based on the information it had recorded when the mobile node had sent the request packet.

[0043] If the remote endpoint did not receive the packet, it might send a data packet. In response to any message from the remote endpoint, the agent is requested to respond with a window advertisement of 0, on behalf of the mobile node. The agent is given the exact packet that it needs to send along with the address/port of the remote endpoint and the address and port of the mobile node. The agent records this information and responds to the mobile node with an acknowledgment, step 28.

[0044] Alternately, the agent could be given the details of the response packet, instead of the exact response packet itself.

[0045] Once the mobile node gets confirmation that the home agent has received the request, the mobile node shuts down, steps 15 through 19 in FIG. 1.

[0046] When the mobile node rejoins the network, it asks the home agent to stop responding on its behalf, (a “recovery request”) step 30, and resumes communication by opening a window. The agent then stops handling the remote peer's persist probes, and removes the binding that had been requested, step 29. The remote peer exits persist state when it receives a window advertisement greater than 0 (opening of the window).

[0047] Alternatively, the home agent may be configured with a timeout, such that if it does not receive a recovery request from the mobile node within the timeout, it can terminate the request for handling the remote peer's probes. It is preferable to contact the nearest agent to the mobile node, since it is likely to be on the same link or a short hop away. Thus, the invention can be further modified to pass the persist probe handling to the foreign agent.

Extension of TCP

[0048] As an alternative to the preferred embodiment of the invention, a client can request the remote peer to support a persistent TCP connection, based on two additional TCP options. This alternative requires neither an intermediate agent, nor repeated persist probes from the remote server. However, it does require modification of the TCP stack to support the options.

[0049] 1) TCPOPT_PERSIST_REQ Option:

[0050] Referring to FIG. 3, the remote peer is requested to support the persist timeout that will be requested later. If the remote peer supports the option, the client will use the TCPOPT_PERSIST_TO option to inform it of the time for which the connection may be inactive. The remote end will keep the connection open, but will not probe it until the time period requested times out. TCPOPT_PERSIST REQ option is sent with the SYN segment, step 32. It includes a cookie value that must change with every SYN segment, including retransmit.

[0051] If the remote endpoint is willing to accept TCPOPT_PERSIST_TO option later, the remote endpoint ACKs the SYN with TCPOPT_PERSIST_REQ, step 33, but without the cookie. The mobile node records the fact that the remote endpoint has accepted the persist request option, and the connection is setup normally, step 34. If the ACK does not have the option included, then the request has been denied.

[0052] 2) TCPOPT_PERSIST_TO Option:

[0053] When sending the window advertisement of 0 at the time of shutdown, the client may add this TCP option, step 36. It includes the cookie that had originally been sent with the SYN segment for verification by the remote endpoint. This option specifies the timeout period in which the mobile host is expected to reconnect.

[0054] The remote node is required to acknowledge the receipt of this window advertisement with an immediate persist probe, step 38. This is regarded as an acknowledgment by the mobile node. Notably, a mobile node might retransmit the window advertisement multiple times (a retransmit is possible if the node does not get the persist probe), in which case the server is required to reply each time. When the mobile node receives the acknowledgment, it shuts down, step 39.

[0055] The server will not probe further until the timeout specified in the TCPOPT_PERSIST_TO option. If the server does not receive any response when the timeout expires, it will retransmit in the usual way, i.e., it will start the persist probes, just as it would have if it had received a window advertisement of zero bytes and there was no TCPOPT_PERSIST_TO option. The server will eventually terminate the connection if it does not receive any reply from the mobile node.

[0056] If the mobile node rejoins the network before the expiry of TCPOPT_PERSIST_TO timeout or before the remote server gives up persist probes, it will send a window open advertisement to the remote server, and the communication will continue normally.

[0057] The above two alternatives may be used in combination with the preferred embodiment, or in the alternative, one or both of the options can be selectively used by the administrator without any impact on the working of any other protocol or network.

Alternative Embodiments

[0058] In an additional alternative embodiment of the present invention, the invention could be implemented for non-mobile clients. Essentially, this is accomplished by handing off the handling of the remote endpoints persist probe to a device that is not going down.

[0059] In yet another alternative embodiment of the present invention, periodic saves of the TCP endpoint state could be made to protect against a possible crash of the system. The application must be capable of crash recovery. Then, the connection could be resumed on reboot.

[0060] In still another alternative embodiment, the invention can be used to migrate connections between server systems. This method is useful when a system has to be shutdown for maintenance or upgrades. The state can be saved on a medium accessible to the system that is going to take over, or it could be sent to the system over the network. The system being shutdown advertises a window of zero, causing the remote system to go into persist state. The system taking over the connection replaces the home agent in this solution, and it will, as required, also take over the IP address of the system being shutdown. The original system then shuts down, at which point the system taking over the connection restarts the application and reacquires the connection as described in the invention. The new system must adapt slightly to the prior handling of the persist requests. If TCP extensions are used, then the cookie needs to be passed to the server taking over service. However, in this case the server taking over the endpoint will not have to field persist probes.

[0061] Moreover, although the present invention is a method to keep TCP connections alive across reboots, the invention is not limited to TCP. An alternative embodiment for UDP could be conducted analogously as far as the application is concerned. UDP deactivation is much simpler, and there is no protocol state to be maintained.

[0062] For the orderly shutdown of the UDP endpoint (Deactivation), the UDP engine fails/blocks all calls from the application. All data in the socket buffers would be dropped, and the local endpoint state is transferred to the fail-over standby. The state information thus comprises the local IP address, local port, the foreign address and the foreign port. The socket and the UDP control block would be dissociated from the file descriptor. Then, the rest of the application recovery and start would be as described in the case of TCP applications.

[0063] Computer-readable signal bearing media include, but are not limited to, floppy disks, hard disks, tape and CD-ROMs.

[0064] It will be appreciated that, although preferred and alternative embodiments of the invention have been described herein for purposes of illustration, various modifications may be made without departing from the spirit and scope of the invention. Therefore, it is manifestly intended that this invention be limited only by the claims and the equivalents thereof. 

We claim:
 1. A method for maintaining connection between a first node and a second node in a computer network comprising: placing the connection between the first node and the second node in a persist state; placing the second node in an inactive state; and reconnecting the first node and the second node.
 2. The method of claim 1, further comprising: repetitively polling the second node by the first node; and responding by a third node acting as an agent on behalf of the second node to the polls.
 3. The method of claim 1, further comprising: requesting by the second node that the first node keep the connection open for a predetermined amount of time; and maintaining the connection for that predetermined amount of time.
 4. The method of claim 1, further comprising activating a connection between a first node and a fourth node during a shutdown of the first node.
 5. The method of claim 1, wherein the network utilizes UDP protocol.
 6. A method for maintaining a connection between a node and a network, comprising: requesting an agent to respond on behalf of the node; providing connection information to the agent; and placing the node in an inactive state.
 7. The method of claim 6, further comprising: reactivating the node; and requesting the agent to stop responding on behalf of the node.
 8. The method of claim 6, wherein the node is mobile.
 9. A system for maintaining connection between a first node and a second node in a computer network, comprising: means for placing the connection between the first node and the second node in a persist state, in which the first node repetitively polls the second node; means for responding by third node on behalf of the second node to the polls, such that the first node maintains the connection; and means for placing the second node in an inactive state.
 10. The system of claim 9, further comprising: means for reactivating the second node; and means for reactivating the connection between the second node and the first node.
 11. The system of claim 9, further comprising a means for creating (activating) a connection between a first node and a fourth node during a shutdown of the first node.
 12. A system for maintaining connection between a node and a computer network comprising: means for requesting an agent to respond on behalf of the node; means for transferring connection information to the agent; and means for placing the node in an inactive state.
 13. The system of claim 12, further comprising: means for reactivating the node; and means for requesting the agent to stop responding on behalf of the node.
 14. The system of claim 12, wherein the node is mobile.
 15. An article for maintaining connection between a first node and a second node in a computer network system comprising: a computer-readable signal-bearing medium; means in the medium for placing the connection between the first node and the second node in a persist state, in which the first node repetitively polls the second node; means in the medium for responding by third node on behalf of the second node to the polls, such that the first node maintains the connection; and means in the medium for placing the second node in an inactive state.
 16. The article of claim 15, further comprising: means in the medium for reactivating the second node; and means in the medium for reactivating the connection between the second node and the first node.
 17. The article of claim 15, further comprising means in the medium for activating a connection between the first node and a fourth node during a shutdown of the first node.
 18. An article for maintaining connection between a node and a computer network comprising: a computer-readable signal-bearing medium; means in the medium for requesting an agent to respond on behalf of the node; means in the medium for providing or transferring connection information to the agent; and means in the medium for placing the node in an inactive state.
 19. The article of claim 18, further comprising: means in the medium for reactivating the node; and means in the medium for requesting the agent to stop responding on behalf of the node.
 20. The article of claim 18, wherein the medium is selected from the group consisting of: a recordable data storage medium; and a modulated carrier signal. 